package com.itheima.dubbo.service;

import com.itheima.dubbo.User;
import com.itheima.dubbo.UserInterface;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;

/**
 *
 */
//dubbo//注册到注册中心
//@DubboService(timeout = 3000)  //超时时间配置 默认1s
//@DubboService(methods = {//优先级最高
//        @Method(name = "hello",timeout = 9000),
//        @Method(name = "aa",timeout = 9000)
//})
//    @DubboService(version = "1.0.1")
    @DubboService(loadbalance = "roundrobin",weight = 10)
public class UserServiceImpl implements UserInterface {

    @Override
    public String hello(String username) {

//        try {
//            Thread.sleep(2000L);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return "hello Dubbo username:"+username;
    }

    @Override
    public User findUser(User uservo) {
        User user = new User();
        user.setName(uservo.getName());
        return user;
    }

    public void aa(){

    }
}
